/**
 * Copyright 2011 Mathieu Magnaudet
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package edu.enac.geoapp.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.geotools.map.MapLayer;

import edu.enac.geoapp.wims.model.Metadata;

/**
 * 
 * @author mathieu
 * Class encapsulating a list of MapLayer and the associated meta data
 */
public class DisplayableForecast {
	private List<MapLayer> layerList;
	private Map<String, Metadata> metaData;
	
	/**
	 * Simple constructor initializing the data structure 
	 */
	public DisplayableForecast() {
		layerList = new ArrayList<MapLayer>();
		metaData = new HashMap<String, Metadata>();
	}
	
	/**
	 * Add a layer and the associated meta data
	 * @param layer The layer to add
	 * @param metadata2 the associated metadata
	 */
	public void addLayer(MapLayer layer, Metadata metadata2) {
		layerList.add(layer);
		metaData.put(layer.getTitle(), metadata2);
	}

	/**
	 * 
	 * @return The list of MapLayer
	 */
	public List<MapLayer> getLayerList() {
		return layerList;
	}
	
	/**
	 * Returns the meta data associated to the specified MapLayer 
	 * @param layerName The name of the layer
	 * @return the associated meta data
	 */
	public Metadata getMetadata(String layerName) {
		return metaData.get(layerName);
	}

}
